package com.tbit.uqbike.service.business.impl;

import com.tbit.uqbike.object.pojo.CallConfig;
import com.tbit.uqbike.service.business.CallConfigService;
import com.tbit.uqbike.webmanager.dao.core.CallConfigDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: chen
 * @Description:
 * @Date: 创建于 11:57 2020/8/5
 */
@Service
public class CallConfigServiceImpl implements CallConfigService {
    @Autowired
    private CallConfigDao callConfigDao;

    @Override
    public CallConfig getByAccountId(Integer accountId) {

        return callConfigDao.getByAccountId(accountId);
    }

    @Override
    public void insert(CallConfig callConfig) {
        CallConfig callConfigDB = getByAccountId(callConfig.getAccountId());
        if (callConfigDB != null) {
            edit(callConfig);
        } else {
            callConfigDao.insert(callConfig);
        }

    }

    @Override
    public void edit(CallConfig callConfig) {
        callConfigDao.edit(callConfig);
    }
}
